package com.yy.wga.wechat.service.controller;

import com.yy.wga.common.core.dto.Result;
import com.yy.wga.wechat.feign.api.WechatQrCodeFeign;
import com.yy.wga.wechat.feign.request.WechatQrCodeGetReq;
import com.yy.wga.wechat.service.manager.WechatQrCodeManager;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信小程序码
 *
 * @author guochao
 * @since 2024-12-10 22:41:43
 */
@RestController
@RequestMapping(value = "/api/wechat/qrCode/")
public class WechatQrCodeController implements WechatQrCodeFeign {
    @Resource
    private WechatQrCodeManager wechatQrCodeManager;

    /**
     * 获取小程序码
     * @param request WechatQrCodeGetReq
     * @return String
     */
    @Override
    @PostMapping("getQrCode")
    public Result<String> getQrCode(@RequestBody @Valid WechatQrCodeGetReq request) {
        String qrCode = wechatQrCodeManager.getQrCode(request);
        Result<String> result = Result.success();
        return result.setData(qrCode);
    }

}
